package com.xywh.composeLibrary.view

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp


@Composable
fun XxButton(
    start: Dp = 0.dp,
    top: Dp = 0.dp,
    end: Dp = 0.dp,
    bottom: Dp = 0.dp,
    height: Dp = 60.dp,
    enabled: Boolean = true,
    enabledContainerColor: Color = Color(0xFFE3E3E4),
    roundedCornerShape: Dp = 10.dp,
    onClick: () -> Unit,
    background: Color = MaterialTheme.colorScheme.primary,
    textColor: Color = Color.Gray,
    enabledTextColor: Color = Color(0xFF989799),
    textSize: TextUnit = 14.sp,
    textValue: String

) {


    Button(
        modifier = Modifier
            .padding(top = top, start = start, end = end, bottom = bottom)
            .fillMaxWidth()
            .height(height),
        shape = RoundedCornerShape(roundedCornerShape),
        enabled = enabled,
        onClick = {
            onClick.invoke()
        },
        colors = ButtonDefaults.buttonColors(
            containerColor = background,
            contentColor = textColor,
            disabledContainerColor = enabledContainerColor,
            disabledContentColor = enabledTextColor,
        ),
        content = { Text(textValue, fontSize = textSize) }
    )
}


